Conversation
| panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011 | ||
| } | ||
|
|
||
| utils.Println("Environment is cloned!") |
There was a problem hiding this comment.
Maybe you can remove this Println to keep only the one you added here:
| os.Exit(1) | ||
| panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011 | ||
| } | ||
| var newEnvId = environment.EnvironmentClone(client, organizationName, projectName, environmentName, newEnvironmentName, clusterName, environmentType, applyDeploymentRule, orgId, envId) |
There was a problem hiding this comment.
variable typo:
| var newEnvId = environment.EnvironmentClone(client, organizationName, projectName, environmentName, newEnvironmentName, clusterName, environmentType, applyDeploymentRule, orgId, envId) | |
| var newEnvironment = environment.EnvironmentClone(client, organizationName, projectName, environmentName, newEnvironmentName, clusterName, environmentType, applyDeploymentRule, orgId, envId) |
| var newEnvId = environment.EnvironmentClone(client, organizationName, projectName, environmentName, newEnvironmentName, clusterName, environmentType, applyDeploymentRule, orgId, envId) | ||
|
|
||
| utils.Println("Environment is cloned!") | ||
| utils.Println("your new environment ID is: " + newEnvId.Id) |
There was a problem hiding this comment.
Maybe we can improve the message, e.g:
| utils.Println("your new environment ID is: " + newEnvId.Id) | |
| utils.Println(fmt.Sprintf("Your environment has been cloned [id: %s, name: %s]", newEnv.Id, newEnv.name)) |
| var changeAutoDeploy = false | ||
| if cmd.Flags().Changed("auto-deploy") { | ||
| req.AutoDeploy = *qovery.NewNullableBool(&applicationAutoDeploy) | ||
| changeAutoDeploy = true |
There was a problem hiding this comment.
iiuc you should target &applicationAutoDeploy instead of setting to true.
The condition cmd.Flags().Changed("auto-deploy") means that the flag has been set (it can be true or false).
Also, you should use a nullable variable type to be able to keep the current behavior, see https://github.com/Qovery/qovery-cli/pull/379/files#diff-347ce49b39961c56097bf8e9b5eee84236e37636a3615f43ab6197e9293bba7eR70
| if changeAutoDeploy { | ||
| req.AutoDeploy = *qovery.NewNullableBool(&applicationAutoDeploy) | ||
| } |
There was a problem hiding this comment.
Here the changeAutoDeploy function parameter should be a nullable boolean (autodeploy *bool), to set the req.AutoDeploy only if this is not null, e.g
if autodeploy != nil {
[...]
}
| "github.com/qovery/qovery-client-go" | ||
| ) | ||
|
|
||
| func EnvironmentDeploy(client *qovery.APIClient, organizationName string, projectName string, environmentName string, newEnvironmentName string, clusterName string, environmentType string, applyDeploymentRule bool, envId string, servicesJson string, applicationNames string, containerNames string, lifecycleNames string, cronjobNames string, helmNames string, skipPausedServicesFlag bool, watchFlag bool) { |
There was a problem hiding this comment.
You should auto-reformat to add line breaks for each param (more readable):
func EnvironmentDeploy(
client *qovery.APIClient,
organizationName string
[...]
)
First part of ticket "Create Preview environments via CLI"
Split CMD and functions for: